package offer;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * 描述:剑指 Offer 03. 数组中重复的数字
 *
 * @author Madison You
 * @created 23:07
 */
public class Easy_03_FindRepeatNumber {
    public static void main(String[] args) {

    }

    public int findRepeatNumber(int[] nums) {
        Map<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < nums.length; i++) {
            if (map.get(nums[i]) != null) {
                return nums[i];
            }
            map.put(nums[i], 1);
        }
        return 0;
    }
}
